﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="EditCompany.aspx.cs" Inherits="Company_EditCompany" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <h2>
        编辑公司
        <asp:Label runat="server" Text='<%#Eval("EnglishName")%>' ID="MyEnglishName"></asp:Label></h2>
    <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1" DefaultMode="Edit"
        OnItemUpdated="FormView1_ItemUpdated" OnItemUpdating="FormView1_ItemUpdating"
        DataKeyNames="CompanySerialNumber">
        <EditItemTemplate>
            <ul class="formul">
                <li><span class="formtitle">公司编号</span>
                    <asp:TextBox ID="CompanyIDTextBox" runat="server" Text='<%#Bind("CompanyID")%>' /></li>
                <li><span class="formtitle">公司英文名</span>
                    <asp:TextBox ID="EnglishNameTextBox" runat="server" Text='<%#Bind("EnglishName")%>'
                        Width="300px" /></li>
                <li><span class="formtitle">公司中文名</span>
                    <asp:TextBox ID="ChineseNameTextBox" runat="server" Text='<%#Bind("ChineseName")%>'
                        Width="300px" /></li>
                <li><span class="formtitle">董事长</span>
                    <asp:TextBox ID="ChairmanTextBox" runat="server" Text='<%#Bind("Chairman")%>' Width="100px" /></li>
                <li><span class="formtitle">注册区域</span>
                    <asp:DropDownList runat="server" ID="RegeistRegion" DataSourceID="SqlDataSource2"
                        DataTextField="RegionName" DataValueField="RegionID" SelectedValue='<%# Bind("RegionID") %>'>
                    </asp:DropDownList>
                    <asp:TextBox ID="RegionIDTextBox" runat="server" Text='<%#Bind("RegionID")%>' /></li>
                <li><span class="formtitle">注册股份数</span>
                    <asp:TextBox ID="StockTextBox" runat="server" Text='<%#Bind("Stock")%>' Width="100px" /></li>
                <li><span class="formtitle">注册日期</span>
                    <asp:TextBox ID="RegisterDateTextBox" runat="server" Text='<%# Bind("RegisterDate", "{0:yyyy-MM-dd}") %>' /></li>
                <li><span class="formtitle">公司级别</span><asp:CheckBox ID="CheckBox1" runat="server"
                    Text="属于分行" Checked='<%# Bind("IsSubsidiary") %>' />
                    总行CI编号<asp:TextBox ID="TextBox1" runat="server" 
                        Text='<%# Bind("ParentCompany") %>'></asp:TextBox></li>
            </ul>
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                Text="更新" />
            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False"
                CommandName="Cancel" Text="取消" OnClientClick="javascript:location.href='CompanyList.aspx'" />
        </EditItemTemplate>
        <InsertItemTemplate>
        </InsertItemTemplate>
        <ItemTemplate>
        </ItemTemplate>
    </asp:FormView>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:KOONCRMDB %>"
        SelectCommand="SELECT [RegionName], [RegionID] FROM [Region]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:KOONCRMDB %>"
        SelectCommand="SELECT CompanySerialNumber, CompanyID, EnglishName, Chairman, ChineseName, RegionID, Stock, RegisterDate, Status, ParentCompany, IsSubsidiary FROM Company WHERE (CompanySerialNumber = @CompanySerialNumber)"
        UpdateCommand="UPDATE Company SET CompanyID = @CompanyID, EnglishName = @EnglishName, ChineseName = @ChineseName, Chairman = @Chairman, RegionID = @RegionID, Stock = @Stock, RegisterDate = @RegisterDate, LastModifyTime = GETDATE() WHERE (CompanySerialNumber = @CompanySerialNumber)">
        <SelectParameters>
            <asp:QueryStringParameter Name="CompanySerialNumber" QueryStringField="ID" Type="String" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="CompanyID" />
            <asp:Parameter Name="EnglishName" />
            <asp:Parameter Name="ChineseName" />
            <asp:Parameter Name="Chairman" />
            <asp:Parameter Name="RegionID" />
            <asp:Parameter Name="Stock" />
            <asp:Parameter Name="RegisterDate" />
            <asp:Parameter Name="CompanySerialNumber" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>
